import random


def showTitle(title):
    print('%s%s' % ('*' * 11 * 2, '*' * len(title) * 2))
    print('*%s%s%s*' % (' ' * 10, title, ' ' * 10))
    print('%s%s' % ('*' * 11 * 2, '*' * len(title) * 2))


def showCardsInfo(cardsTitle, cards, hp):
    if len(cards) <= 0:
        return

    print(cardsTitle + '：', end='')
    for i in range(len(cards)):
        print('[%d-%s/%s]' % (i + 1, cards[i], hp[i]), end='')
    print()


def showRoundInfo(roundTitle, wofangpai, wofang_hp, duifangpai, duifang_hp):
    print(roundTitle)
    showCardsInfo('我方卡牌', wofangpai, wofang_hp)
    showCardsInfo('对方卡牌', duifangpai, duifang_hp)


def attach(roleTitle, gongjifang, beigongjifang, beigongjifang_hp):
    if len(gongjifang) <= 0:
        return

    print(roleTitle)
    if roleTitle == '[我方攻击]':
        gongji = int(input('请选择我方攻击卡牌：'))
        beigongji = int(input('请选择对方被攻击卡牌：'))
    else:
        gongji = random.randint(1, len(gongjifang))
        beigongji = random.randint(1, len(beigongjifang))
    beigongjifang_hp[beigongji - 1] -= 3

    if beigongjifang_hp[beigongji - 1] <= 0:
        print('[%d-%s]攻击了[%d-%s]，[%d-%s]弃牌' % (
            gongji, gongjifang[gongji - 1],
            beigongji, beigongjifang[beigongji - 1],
            beigongji, beigongjifang[beigongji - 1]))
        beigongjifang.pop(beigongji - 1)
        beigongjifang_hp.pop(beigongji - 1)
    else:
        print('[%d-%s]攻击了[%d-%s]，[%d-%s]生命值为%d' % (
            gongji, gongjifang[gongji - 1],
            beigongji, beigongjifang[beigongji - 1],
            beigongji, beigongjifang[beigongji - 1],
            beigongjifang_hp[beigongji - 1]))


def showEndGame(duifangpai):
    if len(duifangpai) <= 0:
        showTitle('我方大获全胜！')
    else:
        showTitle('lose')


wofangpai = ['皇女', '迪老爷', '凯亚']
wofang_hp = [10, 10, 10]
duifangpai = ['火邱邱人', '邱邱人铠王', '冰邱邱人']
duifang_hp = [3, 8, 3]
lun = 0

showTitle('七圣召唤，派蒙乱蹿！')
showRoundInfo('[牌局开始]', wofangpai, wofang_hp, duifangpai, duifang_hp)
while len(wofangpai) > 0 and len(duifangpai) > 0:
    print('--------------------第%d轮-开始--------------------' % (lun + 1))
    attach('[我方攻击]', wofangpai, duifangpai, duifang_hp)
    attach('[对方攻击]', duifangpai, wofangpai, wofang_hp)
    print('--------------------第%d轮-结束--------------------' % (lun + 1))
    showRoundInfo('[战斗结果]', wofangpai, wofang_hp, duifangpai, duifang_hp)
    print('*' * 50)
    lun += 1
showEndGame(duifangpai)
